//
//  GearsItemView.m
//  BalanceCar
//
//  Created by 郑信鸿 on 17/6/27.
//  Copyright © 2017年 郑信鸿. All rights reserved.
//

#import "GearsItemView.h"

@implementation GearsItemView{
    
    UIImageView *_gearImage;
}


- (instancetype)init{
    
    if (self = [super init]) {
        
        UIImageView *itemImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"dashboard_gear_selected"]];
        [self addSubview:itemImage];
        [itemImage mas_makeConstraints:^(MASConstraintMaker *make) {
           
            make.centerY.mas_offset(3);
            make.centerX.mas_offset(0);
            
        }];
        _gearImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"dashboard_gear_i"]];
        [self addSubview:_gearImage];
        [_gearImage mas_makeConstraints:^(MASConstraintMaker *make) {
           
            make.center.mas_offset(0);
        }];
    }
    return self;
}

- (void)setGearsNum:(GearsItemNum)gearsNum{
    _gearsNum = gearsNum;
    NSString *imageName = nil;
    switch (gearsNum) {
        case GearsItemOne:
        {
            imageName = @"dashboard_gear_i";
        }
            break;
        case GearsItemTwo:{
            imageName = @"dashboard_gear_ii";
        }
            break;
        case GearsItemThree:{
            
            imageName = @"dashboard_gear_iii";
        }
            break;
        default:{
            imageName = @"dashboard_gear_iii";
        }
            break;
    }
    _gearImage.image = [UIImage imageNamed:imageName];
}


@end
